package com.it.gmall.order.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.it.gmall.model.cart.CartInfo;
import com.it.gmall.order.mapper.CartInfoMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class OrderApiServiceAsyncImpl implements OrderApiServiceAsync {

    @Autowired
    private CartInfoMapper cartInfoMapper;

    // 批量删除DB中的购物车数据-使用异步的方式
    @Async
    @Override
    public void deleteCartInfo(Long userId, List<Long> idsLong) {
        cartInfoMapper.delete(new QueryWrapper<CartInfo>().eq("user_id",userId)
        .in("sku_id",idsLong));
    }
}
